]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[lg] fix queue_relayout warnings
authorDan Winship <danw@gnome.org>
Wed, 21 Jul 2010 15:50:58 +0000 (11:50 -0400)
committerDan Winship <danw@gnome.org>
Mon, 23 Aug 2010 17:03:58 +0000 (13:03 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=624940

js/ui/lookingGlass.js

index 5c350d1c9293877ea57985ebb1cd8b8af9ec8fcf..19059da2aebeda809b51094b6a15b9d32f21a676 100644 (file)
@@ -365,17 +365,16 @@ function Inspector() {
 
 Inspector.prototype = {
     _init: function() {
-        let width = 150;
-        let primary = global.get_primary_monitor();
+        let container = new Shell.GenericContainer({ width: 0,
+                                                     height: 0 });
+        container.connect('allocate', Lang.bind(this, this._allocate));
+        Main.uiGroup.add_actor(container);
+
         let eventHandler = new St.BoxLayout({ name: 'LookingGlassDialog',
                                               vertical: false,
-                                              y: primary.y + Math.floor(primary.height / 2),
                                               reactive: true });
         this._eventHandler = eventHandler;
-        eventHandler.connect('notify::allocation', Lang.bind(this, function () {
-            eventHandler.x = primary.x + Math.floor((primary.width - eventHandler.width) / 2);
-        }));
-        Main.uiGroup.add_actor(eventHandler);
+        container.add_actor(eventHandler);
         this._displayText = new St.Label();
         eventHandler.add(this._displayText, { expand: true });
 
@@ -398,6 +397,20 @@ Inspector.prototype = {
         this._pointerTarget = null;
     },
 
+    _allocate: function(actor, box, flags) {
+        let primary = global.get_primary_monitor();
+
+        let [minWidth, minHeight, natWidth, natHeight] =
+            this._eventHandler.get_preferred_size();
+
+        let childBox = new Clutter.ActorBox();
+        childBox.x1 = primary.x + Math.floor((primary.width - natWidth) / 2);
+        childBox.x2 = childBox.x1 + natWidth;
+        childBox.y1 = primary.y + Math.floor((primary.height - natHeight) / 2);
+        childBox.y2 = childBox.y1 + natHeight;
+        this._eventHandler.allocate(childBox, flags);
+    },
+
     _close: function() {
         Clutter.ungrab_pointer(this._eventHandler);
         Clutter.ungrab_keyboard(this._eventHandler);